package com.yanwq.nwa;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.yanwq.nwa.im.ChatService;
import com.yanwq.nwa.user.LoginActivity;
import com.yanwq.nwa.user.UserMgr;

public class SplashActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        Intent chatServiceIntent = new Intent(getApplicationContext(), ChatService.class);
        startService(chatServiceIntent);

        if (UserMgr.get() == null) {
            Intent intent = new Intent(this, LoginActivity.class);
            startActivity(intent);
        } else {
            Intent intent = new Intent(this, MainActivity.class);
            startActivity(intent);
        }
    }
}
